export const useVersionStore = defineStore('version', () => {
  // 当前版本号
  const version = ref('');
  // 更新版本号
  const updateVersion = async () => {
    const versionJson = await fetch('/version.json').then((res) => res.json());
    version.value = versionJson.version;
  };
  // 检查是否需要更新
  const compareVersion = async () => {
    const versionJson = await fetch('/version.json').then((res) => res.json());
    return version.value != versionJson.version;
  };
  return {
    version,
    updateVersion,
    compareVersion
  };
});

export default useVersionStore;
